package com.kwdata.quartz.controller;

import com.kwdata.quartz.constant.AjaxResult;
import com.kwdata.quartz.domain.Patient;
import com.kwdata.quartz.dto.PatientQueryDto;
import com.kwdata.quartz.service.IPatientService;
import com.kwdata.quartz.task.PatientInfoTask;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;


@Api(value = "任务", tags = "任务")
@RestController
@RequestMapping("/job")
public class JobController {

    @Resource
    IPatientService patientService;

    @Resource
    PatientInfoTask patientInfoTask;


    //@ApiOperation("患者列表")
    @GetMapping("/list")
    public AjaxResult list() {
        List<Patient> list = patientService.list();
        return AjaxResult.success(list);
    }


    /**
     * 按时间抽取患者信息
     */
    @ApiOperation("按时间抽取患者信息")
    @GetMapping("/patient/run")
    public AjaxResult patientRun(PatientQueryDto dto){
        patientInfoTask.getInfo(dto);
        return AjaxResult.success();
    }

}
